package com.zyit.service;

import com.zyit.service.Impl.ClassifyServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;


@WebServlet("/classInsert")
public class ClassifySaveUpdateService extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String classname = req.getParameter("classname");
        String class1 = req.getParameter("class1");
        String class2 = req.getParameter("class2");

        ClassifyService service =new ClassifyServiceImpl();
        try {
            int i = service.InsertClassfiy(classname, class1, class2);
            if (i==1){
                resp.getWriter().write("true");
            }else {
                resp.getWriter().write("false");
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

    }
}
